﻿using Learun.Util;
using SqlSugar;
using System;
namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-01 15:08
    /// 描 述：数据字典
    /// </summary>
    [SugarTable(TableName = "ec_dataitem")]
    public class ec_dataitemEntity 
    {
        #region 实体成员
        /// <summary>
        /// 字典分类ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public string DataItemID { get; set; }
        /// <summary>
        /// 上级字典分类ID
        /// </summary>
        public string UpDataItemID { get; set; } = "";
        /// <summary>
        /// 字典分类名称
        /// </summary>
        public string DataItemName { get; set; } = "";
        /// <summary>
        /// 字典分类编号(存的是名字。如be_signal_group）
        /// </summary>
        public string DataItemCode { get; set; } = "";
        /// <summary>
        /// 排序
        /// </summary>
        public int? OrderID { get; set; }
        /// <summary>
        /// 是否有效
        /// </summary>
        public int? IsEnabled { get; set; }
        /// <summary>
        /// 是否树形
        /// </summary>
        public int? IsTree { get; set; }
        /// <summary>
        /// 是否允许编辑
        /// </summary>
        public int? IsAllowEdit { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.DataItemID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.DataItemID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion
        #region 扩展字段
        #endregion
    }
}

